package cn.tedu.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("car")
public class CarController {
    @RequestMapping("get")
    public String get(String name,Integer id){
        return id+name;
    }
    //解析restful传递的参数:简化get请求方式参数的写法
    @RequestMapping("get2/{id}/{name}")
    //{x}--通过{}获取访问路径中携带的参数,并且交给变量x保存
    public String get2(@PathVariable Integer id,
                       @PathVariable String name){
        return id+name;
    }
    @RequestMapping("get3/{id}/{name}/{coler}/{dou}")
    public String get3(
            @PathVariable Integer id,
            @PathVariable String name,
            @PathVariable String coler,
            @PathVariable Double dou){
        return id+name+coler+dou;
    }

}
